<template>
	<view class="page">

		<mescroll-uni ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback">
			<!-- :down="downOption" :up="upOption" -->

			<uni-list>

				<view class="item" @click="goDetail(item)" v-for="(item, index) in listdata" :key="index">

					<view class="text-line" style="margin-top: 20rpx;">
						<text class="text-name">姓名:</text>
						<text class="text-value">{{item.memberName|filterNull}}</text>
					</view>

					<view class="text-line">
						<text class="text-name">身份证号:</text>
						<text class="text-value">{{item.driversNo|filterNull}}</text>
					</view>

					<view class="text-line">
						<text class="text-name">查询时间:</text>
						<text class="text-value">{{item.queryTime|filterNull}}</text>
					</view>

				</view>
			</uni-list>

		</mescroll-uni>


	</view>
</template>

<script>
	import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";

	export default {
		mixins: [MescrollMixin],
		components: {
		},
		data() {
			return {
				page: 1,
				listdata: [],
			}
		},
		methods: {
			getData() {

				this.$u.api.queryDriversInfoList({
						pageNo: this.page,
					}).then(
						res => {
							// if (res.code == 1) {
							if (this.page == 1) {

                this.listdata = [];
              }
              this.listdata = this.listdata.concat(res);
              this.mescroll.endSuccess(res.length);
              // }
						}
					)
					.catch(() => {
						this.mescroll.endErr();
					})
			},


			goDetail(item) {
				uni.navigateTo({
					url: '/pagesA/querydrivecard/query-result'+uni.$u.queryParams(item)
				})
			},


			upCallback(page) {
				console.log("触发了上拉加载" + page);

				this.page = page.num;
				this.getData();
			},

		}
	}
</script>

<style lang="scss">
	.page {
		background-color: $grayf5;
	}

	.item {
		display: flex;
		flex-direction: column;
		background-color: white;
		border-radius: 8rpx;
		margin: 10rpx 20rpx;
		padding-bottom: 10rpx;
	}

	.title {
		width: 100%;
		height: 80rpx;
		line-height: 80rpx;
		font-size: 28rpx;
		color: $black33;
		margin-left: 20rpx;
	}

	.text-warn {
		font-size: 24rpx;
		color: $rede9;
		margin-right: 20rpx;
	}

	.text-warn-orange {
		color: $yellowffc;
	}

	.btn-detail {
		width: 180rpx;
		height: 60rpx;
		border-radius: 50rpx;
		color: white;
		text-align: center;
		background-color: $blue15;
		font-size: 26rpx;
		line-height: 60rpx;
		margin: 10rpx 20rpx 10rpx;
		align-self: flex-end;
	}
</style>
